package com.gj.demojuc.chap01;

/**
 * 线程创建方式
 * 继承thread类
 * 实现runnable接口
 * 实现callable接口
 * 线程池ThreadPoolExecutor
 */

class T1 extends Thread{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "\t" + "----come in");
    }
}

class T2 implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "\t" + "----come in");
    }
}

public class ThreadDemo {
    public static void main(String[] args) {
        T1 t1 = new T1();
        t1.start();
        T2 t2 = new T2();
        Thread thread = new Thread(t2,"t2线程");
        Thread thread1 = new Thread(t2,"t3线程");
        thread.start();
        thread1.start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + "\t" + "----come in");
            }
        },"t4").start();

        new Thread(()->System.out.println(Thread.currentThread().getName() + "\t" + "----come in"),"t5").start();
    }
}
